<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<div id="editForProjectDelivery" class="easyui-window" title="审核项目交付"
	data-options="modal:true,closed:true,iconCls:'icon-search'"
	style="width: 980px; height: 520px; padding: 5px;">
	<div class="easyui-layout" data-options="fit:true">
		<div data-options="region:'center'" style="padding: 10px;">
			<form id="editForProjectDeliveryForm" method="post" action="checkProjectDelivery">
				<input type="hidden" id="projectDeliveryId" name="id" /> 
				<input type="hidden" id="projectDeliveryStatus" name="status" value="3000" />
				<table>
					<tr>
						<td width="100px;" align="right">所属项目：</td>
						<td>
							<input class="easyui-textbox" readonly="readonly" id="projectDeliveryProjectName" style="width: 200px;" />
						</td>
						<td width="100px;" align="right">交付物类型：</td>
						<td>
							<input class="easyui-textbox" readonly="readonly" id="projectDeliveryProjectDeliveryTypeName" style="width: 200px;" />
						</td>
						<td width="100px;" align="right">生产厂家：</td>
						<td>
							<input class="easyui-textbox" readonly="readonly" id="projectDeliveryProducer" style="width: 200px;" />
						</td>
					</tr>
					<tr>
						<td align="right">交付物名称：</td>
						<td>
							<input class="easyui-textbox" readonly="readonly" id="projectDeliveryName" style="width: 200px;" />
						</td>
						<td align="right">单位：</td>
						<td>
							<input class="easyui-textbox" readonly="readonly" id="projectDeliveryUnit" style="width: 200px;" />
						</td>
						<td align="right">交付数量：</td>
						<td>
							<input class="easyui-textbox" readonly="readonly" id="projectDeliveryDeliveryNumber" style="width: 200px;" />
						</td>
					</tr>
					<tr>
						<td align="right">交付日期：</td>
						<td>
							<input class="easyui-textbox" readonly="readonly" id="projectDeliveryDeliveryDate" style="width: 200px;" />
						</td>
						<td align="right">我方经手人：</td>
						<td>
							<input class="easyui-textbox" readonly="readonly" id="projectDeliveryOurHandler" style="width: 200px;" />
						</td>
						<td align="right">对方经手人：</td>
						<td>
							<input class="easyui-textbox" readonly="readonly" id="projectDeliveryCustomerHandler" style="width: 200px;" />
						</td>
					</tr>
					<tr>
						<td align="right">交付方式：</td>
						<td>
							<input class="easyui-textbox" readonly="readonly" id="projectDeliveryDeliveryWayName" style="width: 200px;" />
						</td>
						<td align="right">交付地点：</td>
						<td>
							<input class="easyui-textbox" readonly="readonly" id="projectDeliveryDeliveryAddress" style="width: 200px;" />
						</td>
						<td align="right">凭证号码：</td>
						<td>
							<input class="easyui-textbox" readonly="readonly" id="projectDeliveryVoucherNo" style="width: 200px;" />
						</td>
					</tr>
					<tr>
						<td align="right">批次号：</td>
						<td>
							<input class="easyui-textbox" readonly="readonly" id="projectDeliveryBatchNo" style="width: 200px;" />
						</td>
						<td align="right">规格：</td>
						<td>
							<input class="easyui-textbox" readonly="readonly" id="projectDeliverySpec" style="width: 200px;" />
						</td>
						<td align="right">保修期限：</td>
						<td>
							<input class="easyui-textbox" readonly="readonly" id="projectDeliveryWarrantyDate" style="width: 200px;" />
						</td>
					</tr>
					<tr>
						<td align="right">备注：</td>
						<td colspan="5">
							<input class="easyui-textbox" id="projectDeliveryRemark" readonly="readonly" style="width: 830px; height: 80px;" data-options="multiline:true"/>
						</td>
					</tr>
				</table>
			</form>
			<div style="height: 200px;">
				<table id="projectDeliveryDetailDg" class="easyui-datagrid"
					title="交付物明细"
					data-options="
						rownumbers:true,
						singleSelect:true,
						pagination:true,
						fit:true,
						fitColumns:true">
					<thead>
						<tr>
							<th
								data-options="field:'productSequenceNo',width:80,align:'center'">产品序列号</th>
							<th data-options="field:'eTag',width:80,align:'center'">电子标识号</th>
							<th data-options="field:'remark',width:270,align:'center'">描述</th>
						</tr>
					</thead>
				</table>
			</div>

		</div>

		<div data-options="region:'south',border:false"
			style="text-align: right; padding: 5px 0 0;">
			<a class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="$('#editForProjectDeliveryForm').submit();$('#editForProjectDelivery').window('close');" style="width: 80px">通过</a>
			<a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="$('#projectDeliveryStatus').val('2001');$('#editForProjectDeliveryForm').submit();$('#editForProjectDelivery').window('close');" style="width: 80px">驳回</a>
			<a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="javascript:$('#editForProjectDelivery').window('close')" style="width: 80px">关 闭</a>
		</div>
	</div>
</div>


	<script type="text/javascript">
		function editForProjectDelivery(id) {
			$.ajax({url : "getProjectDelivery?id=" + id, success : function(data) {
				clearForm("editForProjectDeliveryForm", "editForProjectDelivery");
				
				var val = $.parseJSON(data);
				$("#projectDeliveryName").textbox("setValue", val.name);
				$("#projectDeliveryProductName").textbox("setValue", val.productName);
				$("#projectDeliveryProjectName").textbox("setValue", val.projectName);
				$("#projectDeliveryProjectDeliveryTypeName").textbox( "setValue", val.projectDeliveryTypeName);
				$("#projectDeliveryProjectCode").textbox("setValue", val.projectCode);
				$("#projectDeliveryProducer").textbox("setValue", val.producer);
				$("#projectDeliveryBatchNo").textbox("setValue", val.batchNo);
				$("#projectDeliveryUnit").textbox("setValue", val.unit);
				$("#projectDeliveryDeliveryNumber").textbox("setValue", val.deliveryNumber);
				$("#projectDeliveryDeliveryDate").textbox("setValue", val.deliveryDate);
				$("#projectDeliveryInputPersonName").textbox("setValue", val.inputPersonName);
				$("#projectDeliveryInputTime").textbox("setValue", val.inputTime);
				$("#projectDeliveryOurHandler").textbox("setValue", val.ourHandler);
				$("#projectDeliveryCustomerHandler").textbox("setValue", val.customerHandler);
				$("#projectDeliveryDeliveryWayName").textbox("setValue", val.deliveryWayName);
				$("#projectDeliveryVoucherNo").textbox("setValue", val.voucherNo);
				$("#projectDeliveryDeliveryAddress").textbox("setValue", val.deliveryAddress);
				$("#projectDeliveryWarrantyDate").textbox("setValue", val.warrantyDate);
				$("#projectDeliverySpec").textbox("setValue", val.spec);
				$("#projectDeliveryRemark").textbox("setValue", val.remark);
				$("#projectDeliveryId").val(id);
				$("#projectDeliveryStatus").val("3000");
				
				projectDeliveryDetailSearch(id);
			}
		});
	}

	function projectDeliveryDetailSearch(projectDeliveryId) {
		var dg = $("#projectDeliveryDetailDg");
		var url = "queryProjectDeliveryDetailByProjectDeliveryId?projectDeliveryId="
				+ projectDeliveryId;
		dg.datagrid('reload', url);
	}

	$("#editForProjectDeliveryForm").form({
		onSubmit : function() {
			var isValid = $(this).form('validate');
			return isValid; // 返回false将停止form提交 
		},
		success : function(data) {
			var val = $.parseJSON(data);
			if (val.success) {
				$('#dg').datagrid('reload');
				bottomRight('提示', '修改成功！');
				$('#editForProjectDelivery').window('close');
			} else {
				$.messager.alert("提示", val.msg, "error");
			}
		}
	});
</script>